package com.ziyueyuwen.xiniao.service.baseservice.order.impl;

import com.ziyueyuwen.xiniao.bean.ZyOrderAddress;
import com.ziyueyuwen.xiniao.dao.ZyOrderAddressMapper;
import com.ziyueyuwen.xiniao.service.baseservice.order.ZyOrderAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wancheng  on 2019/2/26.
 */
@Service
public class ZyOrderAddressServiceImpl implements ZyOrderAddressService {

    @Autowired
    ZyOrderAddressMapper zyOrderAddressMapper;

    @Override
    public List<ZyOrderAddress> getListByCreateUserAccount(String account) {
        ZyOrderAddress param = new ZyOrderAddress();
        param.setCreateUserAccount(account);
        return zyOrderAddressMapper.select(param);
    }

    @Override
    public ZyOrderAddress selectByPreKey(Integer id) {
        return zyOrderAddressMapper.selectByPrimaryKey(id);
    }

    @Override
    public Boolean insert(ZyOrderAddress insert) {
        return returnRes(zyOrderAddressMapper.insertSelective(insert));
    }

    @Override
    public ZyOrderAddress insertUseGeneratedKeys(ZyOrderAddress insert) {
        zyOrderAddressMapper.insertUseGeneratedKeys(insert);
        return insert;
    }

    @Override
    public Boolean update(ZyOrderAddress update) {
        return returnRes(zyOrderAddressMapper.updateByPrimaryKeySelective(update));
    }

    @Override
    public Boolean deleteByPreKey(Integer id) {
        return returnRes(zyOrderAddressMapper.deleteByPrimaryKey(id));
    }
}
